package com.atguigu.knife4j.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ClassName: Knife4jConfiguration
 * Description: Knife4j配置类
 *
 * @author Taeyang
 * @date 2025/3/8
 */
@Configuration
public class Knife4jConfiguration {

    @Bean
    public OpenAPI customOpenApi() {
        return new OpenAPI()
                .info(
                        new Info()
                                .title("我的第一个接口文档")
                                .version("1.0")
                                .description("这是一个测试项目的接口文档")
                );
    }

    @Bean
    public GroupedOpenApi userApi(){
        return GroupedOpenApi
                .builder()
                .group("用户信息管理")
                .pathsToMatch("/user/**")
                .build();
    }

    @Bean
    public GroupedOpenApi systemApi(){
        return GroupedOpenApi
                .builder()
                .group("系统信息管理")
                .pathsToMatch("/product/**")
                .build();
    }
}
